﻿using UnityEngine;
using System.Collections;
public class ModuleComponent<Type> : MonoBehaviour where Type:MonoBehaviour{
	static Type instance = null;
	public static bool IsExist{
		get{ return instance != null; }
	}
	public static Type Instance{
		get{
			if (instance == null){
				instance = FindObjectOfType<Type> ();
				if(instance == null){
					instance = new GameObject(typeof(Type).Name).AddComponent<Type>();
				}
			}
			return instance;
		}
	}
	public virtual void Init(){
	}
}
